home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
cool
/
ge_cool.lha
/
GE_COOL2.1
/
man
/
oldman3
/
Date_Time.3T
< prev
next >
Wrap
Text File
|
1992-06-26
|
11KB
|
344 lines
.TH DATE_TIME
.SH NAME
Date_Time Time zone-independent date and time class
.SH SYNOPSIS
#include <cool/Date_Time.h>
.SH DESCRIPTION
The
Date_Time
class executes time zone-independent date and time functions.
This class supports calendar operations and input and output based upon the
value of an environmental synonym, such as
US_CENTRAL .
This class supports all
time zones in the world, along with several special cases requiring alternate
handling based upon political or daylight saving time differences. Unlike the
ANSI C date and time funtions, this class supports dates before the epoch
(January 1, 1970). Year values specified between 0 and 99 are assumed to be in
the twentieth century.
.SH Base Classes
.SH Friend Classes
None
.SH Public Constructors
.TP
Date_Time ();
Allocates a date and time object with the default time zone and country. A
Warning exception is raised if the default country or the default time has not
been set for the class.
.TP
\f3Date_Time (const Date_Time& \f2dt\f3);\f1
Duplicates the size and entries of a date and time object
dt .
.TP
\f3Date_Time (time_zone \f2tz\f3, country \f2c\f3);\f1
Allocates a date and time object with time zone
tz
and country code
c .
.SH Member Functions
.TP
const char* ascii_date () const;
Returns the date in ASCII format for the appropriate time zone and country.
.TP
const char* ascii_date_time () const;
Returns the date and time in ASCII format for the appropriate time zone and
country.
.TP
\f3const char* ascii_duration (const Date_Time& \f2dt\f3) const;\f1
Returns the duration of time between the date/time object and
dt
in ASCII format.
.TP
const char* ascii_time () const;
Returns the time in ASCII format for the appropriate time zone and country.
.TP
\f3inline void decr_day (int \f2n = \f11\f3);\f1
Decrements the time by the specified number of days. The default is one.
.TP
\f3inline void decr_hour (int\f2 n = \f11\f3);\f1
Decrements the time by the specified number of hours. The default is one.
.TP
\f3inline void decr_min (int \f2n = \f11\f3);\f1
Decrements the time by specified number of minutes. The default is one.
.TP
\f3void decr_month (int \f2n = \f11\f3);\f1
Decrements the time by specified number of months. The default is one.
.TP
\f3inline void decr_sec (int \f2n = \f11\f3);\f1
Decrements the time by specified number of seconds. The default is one.
.TP
\f3inline void decr_week (int \f2n = \f11\f3);\f1
Decrements the time by the specified number of weeks. The default is one.
.TP
\f3void decr_year (int \f2n = \f11\f3);\f1
Decrements the time by the specified number of years. The default is one.
.TP
\f3void end_day (int \f2n = \f11\f3);\f1
Advances the time by the specified number of days, setting the time to
23:59:59. The default is one.
.TP
\f3void end_hour (int \f2n = \f11\f3);\f1
Advances the time by the specified number of hours, setting the time to
hh:59:59. The default is one.
.TP
\f3void end_min (int \f2n = \f11\f3);\f1
Advances the time by the specified number of minutes, setting the time to
hh:mm:59. The default is one.
.TP
\f3void end_month (int \f2n = \f11\f3);\f1
Advances the time by the specified number of months, setting the time to
31/mm/yyyy 23:59:59. The default is one.
.TP
\f3void end_week (int \f2n = \f11\f3);\f1
Advances the time by the specified number of weeks, setting the time to Sunday
23:59:59. The default is one.
.TP
\f3void end_year (int \f2n = \f11\f3);\f1
Advances the time by the specified number of months, setting the time to
31/12/yyyy 23:59:59. The default is one.
.TP
inline const char* get_country () const;
Returns the country in ASCII format.
.TP
inline int get_hour () const;
Returns the value of the hour data member in the object (0-23).
.TP
inline int get_mday () const;
Returns the value of the day of the month data member in the object (1-31).
.TP
inline int get_min () const;
Returns the value of the minutes data member in the object (0-59).
.TP
inline int get_mon () const;
Returns the value of the months data member in the object (0-11).
.TP
inline int get_sec () const;
Returns the value of the seconds data member in the object (0-59).
.TP
inline const char* get_time_zone () const;
Returns the time zone in ASCII format.
.TP
inline int get_wday () const;
Returns the value of the day of the week data member in the object (Sunday=0).
.TP
inline int get_yday () const;
Returns the value of the day of the year data member in the object (0-365)
.TP
inline int get_year () const;
Returns the value of the year data member in the object.
.TP
\f3void incr_day (int \f2n = \f11\f3);\f1
Increments the time by the specified number of days. The default is one.
.TP
\f3void incr_hour (int \f2n = \f11\f3);\f1
Increments the time by the specified number of hours. The default is one.
.TP
\f3void incr_min (int \f2n = \f11\f3);\f1
Increments the time by the specified number of minutes. The default is one.
.TP
\f3void incr_month (int \f2n = \f11\f3);\f1
Increments the time by the specified number of months. The default is one.
.TP
\f3void incr_sec (int \f2n = \f11\f3);\f1
Increments the time by the specified number of seconds. The default is one.
.TP
\f3void incr_week (int \f2n = \f11\f3);\f1
Increments the time by the specified number of weeks. The default is one.
.TP
\f3void incr_year (int \f2n = \f11\f3);\f1
Increments the time by the specified number of years. The default is one.
.TP
inline Boolean is_day_light_savings () const;
Returns
TRUE
if daylight saving time is in effect; otherwise, returns
FALSE .
.TP
\f3inline long operator\- (const Date_Time& \f2dt\f3);\f1
Computes the interval of time between the date and time object and
dt .
.TP
\f3Date_Time& operator= (const Date_Time& \f2dt\f3);\f1
Overloads the assignment operator to replicate the value of one date and time
object to another.
.TP
\f3Date_Time& operator+= (long \f2seconds\f3);\f1
Performs interval addition and assignment.
.TP
\f3Date_Time& operator\-= (long \f2seconds\f3);\f1
Performs interval subtraction and assignment.
.TP
\f3inline Boolean operator=\|= (const Date_Time& \f2dt\f3) const;\f1
Overloads the equality operator for the
Date_Time
class. This function returns
TRUE
if two objects represent the same time; otherwise, this function returns
FALSE .
.TP
\f3inline Boolean operator!= (const Date_Time& \f2dt)\f3 const\f1
Overloads the inequality operator for the
Date_Time
class. This function returns
FALSE
if two objects represent the same time; otherwise, this function returns
TRUE .
.TP
\f3inline Boolean operator< (const Date_Time& \f2dt\f3) const;\f1
Overloads the less-than operator for the
Date_Time
class. This function returns
TRUE
if the date and time object represents a date and time before
dt ;
otherwise, this function returns
FALSE .
.TP
\f3inline Boolean operator<= (const Date_Time& \f2dt\f3) const;\f1
Overloads the less-than-or-equal operator for the
Date_Time
class. This function returns
TRUE
if the date and time object represents a date and time
before or equal to
dt ;
otherwise, this function returns
FALSE .
.TP
\f3inline Boolean operator> (const Date_Time& \f2dt\f3) const;\f1
Overloads the greater-than operator for the
Date_Time
class. This function
returns
TRUE
if the date and time object represents a date and time after
dt ;
otherwise, this function returns
FALSE .
.TP
\f3inline Boolean operator>= (const Date_Time& \f2dt\f3) const;\f1
Overloads the greater-than-or-equal operator for the
Date_Time
class. This function returns
TRUE
if the date and time object represents a date and time
equal to or after
dt ;
otherwise, this function returns
FALSE .
.TP
\f3void parse (char* \f2str\f3, int \f2settz = 0\f3);\f1
Parses the character string
str
input and fills all appropriate data members of
the date and time object. If no value is provided for
settz ,
the parsing
algorithm does not search for a time zone. The parser recognizes most valid
input and always parses relative to the time zone. Fields not specified are
defaulted where appropriate. Illegal input results in an
\f3\f3Error\f1\f1
exception being raised.
.TP
\f3inline void set_country (country \f2c\f3);\f1
Sets the country to the value
c .
.TP
void set_gm_time ();
Sets the date and time to Greenwich mean time.
.TP
void set_local_time ();
Sets the date and time to local time as determined by the time zone and country
code values.
.TP
\f3inline void set_time_zone (time_zone \f2tz\f3);\f1
Sets the time zone to the value
tz .
.TP
\f3void start_day (int \f2n = \f11\f3);\f1
Advances the time the specified number of days, setting the time to 00:00:00.
The default is one.
.TP
\f3void start_hour (int \f2n = \f11\f3);\f1
Advances the time by the specified number of hours, setting the time to
hh:00:00. The default is one.
.TP
\f3void start_min (int \f2n = \f11\f3);\f1
Advances the time by the specified number of minutes, setting the time to
hh:mm:00. The default is one.
.TP
\f3void start_month (int \f2n = \f11\f3);\f1
Advances the time by the specified number of months, setting the time to
01/mm/yyyy 00:00:00. The default is one.
.TP
\f3void start_week (int \f2n = \f11\f3);\f1
Advances the time by the specified number of weeks, setting the time to Monday
00:00:00. The default is one.
.TP
\f3void start_year (int \f2n = \f11\f3);\f1
Advances the time by the specified number of years, setting the time to
01/01/yyyy 00:00:00. The default is one.
.SH Friend Functions
.TP
\f3friend istream operator>> (istream& \f2is\f3, Date_Time& \f2dt\f3);\f1
Overloads the input operator to read the input stream
is ,
and parses the
character string containing the date and time information. The result is
returned in the date and time object
dt .
.TP
\f3friend ostream operator<< (ostream& \f2os\f3, const Date_Time* \f2dt\f3);\f1
Overloads the output operator for a pointer to a date-and-time object. The
object writes the output stream
os
with a character string representing the
date and time object
dt
formatted for the appropriate country.
.TP
\f3friend ostream operator<< (ostream& \f2os\f3, const Date_Time& \f2dt\f3);\f1
Overloads the output operator for a reference to a date-and-time object. The
object writes the output stream
os
with a character string representing the
date and time object
dt
formatted for the appropriate country.
.TP
\f3inline friend void set_default_country (country \f2c);\f1
Sets the default country for the class to the value
c .
.TP
\f3inline friend void set_default_time_zone (time_zone \f2tz\f3);\f1
Sets the default time zone for the class to the value
tz .
.SH COPYRIGHT
Copyright (C) 1991 Texas Instruments Incorporated.
Permission is granted to any individual or institution to use, copy, modify,
and distribute this software, provided that this complete copyright and
permission notice is maintained, intact, in all copies and supporting
documentation.
Texas Instruments Incorporated provides this software "as is" without
express or implied warranty.